#include <omp.h>
//#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "pbsearch.h"

#define REAL float
#define NE 100000
#define NT  8

int main()
{
  int i;
  int ntds = NT;
  int keyid[3];
  double A[NE];
  for(i = 0; i < NE; i++) A[i] = (double)i ;

  double value[3] = {-1, 100.3, 2*NE};

  for (i=0; i<3; i++)
    {
    keyid[i] = omp_bsearch(A, &value[i], NE, sizeof(A[0]), userComparOperator, ntds);
  
  if(keyid[i] == -1) printf("\nKeys not found\n");
  else printf("\nKeys found at interval [%f, %f]\n", A[keyid[i]], A[keyid[i]+1]);
    }
  return 0;
}

